function c = cnk(n, k)
  if k < 0 | n < k | int(n) ~= n | int(k) ~= k
    error('input number must be positive integers');
  end
  c = factorial(n)./(factorial(n-k).*factorial(k));
endfunction

